from flask import Flask
from settiings import Config,db
from blueprints.index import bp as index_bp
from blueprints.list_page import bp as list_bp
from blueprints.detail_page import bp as detail_bp
from blueprints.user_page import bp as user_bp
from blueprints.modify import bp as modify_bp
#新建flask对象
app = Flask(__name__)
# app.secret_key = 'house20250504' 
#导入配置类pip install Flasky
app.config.from_object(Config)
#注册蓝图
app.register_blueprint(index_bp)
app.register_blueprint(list_bp)
app.register_blueprint(detail_bp)
app.register_blueprint(user_bp)
app.register_blueprint(modify_bp)
#初始化数据库链接
db.init_app(app)

app.config['SECRET_KEY'] = 'house20250504'

app.config['MAIL_SERVER'] = 'smtp.qq.com'  # QQ 邮箱的 SMTP 服务器地址    
app.config['MAIL_PORT'] = 587             # SMTP 服务器端口，通常是 587 (TLS) 或 465 (SSL)
app.config['MAIL_USE_TLS'] = True         # 启用 TLS 加密连接
app.config['MAIL_USE_SSL'] = False        # 如果使用了 TLS，通常不使用 SSL；如果端口是 465，可能需要设置为 True 并禁用 TLS
app.config['MAIL_USERNAME'] = '965492893@qq.com' # 你的 QQ 邮箱地址
app.config['MAIL_PASSWORD'] = 'mskihmchvpivbdce' # **不是你的 QQ 邮箱登录密码，是授权码！**
app.config['MAIL_DEFAULT_SENDER'] = '965492893@qq.com' # 默认发件人，可选，但推荐设置

from flask_mail import Mail
mail = Mail(app) # 将配置好的 app 实例传递给 Mail 进行初始化

if __name__ == "__main__":
    app.run()

